﻿<!DOCTYPE html>
<html> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link href="${root!}/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="${root!}/lib/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${root!}/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="${root!}/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
<script src="${root!}/lib/ligerUI/js/plugins/ligerToolBar.js" type="text/javascript"></script>
<script src="${root!}/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
<script src="${root!}/lib/ligerUI/js/plugins/ligerForm.js"></script>
<script src="${root!}/lib/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
<script src="${root!}/lib/ligerUI/js/plugins/ligerTip.js" type="text/javascript"></script>
<script src="${root!}/lib/jquery-validation/jquery.validate.min.js"></script>
<script src="${root!}/lib/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
<script src="${root!}/lib/jquery-validation/messages_cn.js" type="text/javascript"></script>
<script src="${root!}/lib/js/orders.js"></script>
<script> 
var groupicon = "${root!}/lib/ligerUI/skins/icons/communication.gif";
var orghome = '${root!}/lib/ligerUI/skins/icons/home.gif';
var customers = '${root!}/lib/ligerUI/skins/icons/customers.gif';
var communication = '${root!}/lib/ligerUI/skins/icons/communication.gif';
var g = null;
var f = null;
var s = null;

$(function ()
{
	/**工具栏*/
	$("#toptoolbar").ligerToolBar({ items: [{ text: '导出Excel', 
											menu: { 
												width: 100, items:[
					   				             { text: '导出本页', click: function(){f_getExcel(1);} },
									   			 { text: '导出所有', click: function(){f_getExcel(2);} },
						               			 { line: true }]},
											icon:'excel'}
		]});
	
	/**菜品状态*/
	var status = [{value : "0", text : "不销售"},
	              {value : "1", text : "销售中"},
	              {value : "2", text : "售完"}];
	
	/**页面布局 */
	$(function (){
		$("#layout1").ligerLayout({ leftWidth: 200});
	});

	
	/**报表Grid */
	g = $("#reportGrid").ligerGrid({
		columns: [
				  { display: '菜品ID', name: 'DISH_ID',hide: 1} ,  
				  { display: '菜系', name: 'CUISINE_NAME',width: 150},		  
				  { display: '菜名', name: 'NAME',width: 150},
				  { display: '简介', name: 'INFO',width: 150} ,
				  { display: '价格', name: 'PRICE',width: 200},
				  { display: '查看次数', name: 'VIEWCOUNT', width: 150},
				  { display: '状态', name: 'STATUS',width: 80,
					  render:function(rowdata, index, value){
						  if(rowdata.STATUS=='0')
							  return "不销售";
						  else if(rowdata.STATUS == '1')
							  return "销售中";
						  else if(rowdata.STATUS == '2')
							  return "售完";
						  else
							  return rowdata.STATUS;
					 }},
					{ display: '累计销售量', name: 'COUNT',width: 150}  
				], 		
		url: '${root!}/sys/report/getDishJson', 
		pageSize: 20,
		width: '100%', 
		height: '100%',
		frozen: false,
		rownumbers: true,
		method:"post",
		parms:[{name:"order_head_id",value:'0'}]
	}); 
	
	
});

function f_getExcel(isAll){
	if(isAll == 1){
		//只导出当前页
		$("#inputexportpage").val(g.options.page);
		$("#inputexportpagesize").val(g.options.pageSize);
	}else{
		//导出所有
		$("#inputexportpage").val(1);
		$("#inputexportpagesize").val(g.data.Total);
	}
	$("#inputexportfile").val('dish');
	$("#exportdata").submit();	
}

</script>
<style type="text/css"> 
	body{ padding:0px; margin:0; overflow:hidden;}
	#layout1{  width:100%;margin:0; padding:0;  }  
	.l-page-top{ height:80px; background:#f8f8f8; margin-bottom:3px;}
	.tree{
		width:270px;
		height:600px;
		margin: 0px;
		border: 1px solid #ccc;
		overflow: auto;}
</style>
</head>
<body>

<div id="layout1">
	<div position="center" title="">
		<!--报表管理工具栏-->
		<div id="toptoolbar"></div>
		<!--报表管理datagrid-->
		<div id="reportGrid"></div>
	</div>
</div> 
<!-- 导出数据 -->
	<form id="exportdata" method="post"  action="/sys/report/getDishExcel" >
		<input type="hidden" id="inputexportfile" name="file"   value="" />
		<input type="hidden" id="inputexportpage" name="page"   value="" />
		<input type="hidden" id="inputexportpagesize" name="pagesize"   value="" />
	</form>
</body>
</html>
